VBScript command editing

VBScript commands can be edited within procedure or Events windows when the optional VBScript check box is selected at the top of the procedure window. Selecting this check box enables VBScript and disables the standard XpertRule procedural @commands for that procedure. You cannot mix both VBScript and standard XpertRule procedural @commands in the same procedure window.

The command syntax is very similar to Visual Basic. Variables can be calculated (for numerics) or concatenated (for strings) by using this standard syntax:

Num_Tot = NumVar1 + NumVar2

FullName = Title & FirstName & Surname

String and numeric variables can also be concatenated into strings, for example:

NewCode = FirstName & Surname & ID_Number

where ID_Number could be a numeric field.

Pressing this icon or the F5 key enables Commands to be pasted in at the current cursor position in the procedure. Commands can be pasted with a default syntax template.

Pressing this icon or using the F6 key enables Variables from the Knowledge Explorer to be pasted in at the current cursor position. Highlighting a variable name and pressing OK will cause it to be pasted at the current insertion point. Variable/attribute names can be typed in manually but remember that this might increase the chance of simple errors - and variable names are case sensitive.

When using default 'template' commands in a command window, you can highlight any dummy template <variable> and press the icon to replace it with a selected variable from the pop up list box.

The ability to replace text with a selected variable can be used on any highlighted text in a command window. XpertRule will take account of any superfluous highlighted spaces, commas automatically.

Syntax Highlighting enables procedures to be shown with colors used to highlight special text such as VBScript command words.

See also the section on Making references to properties on how to use properties within VBScript.

When using temporary variables you must define them using the Dim command before use.